#!/bin/sh
# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other
# HYPRE Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

INTERNAL_HEADER=krylov.h

#===========================================================================
# Include guards and other includes
#===========================================================================

cat > $INTERNAL_HEADER <<@

#include "HYPRE_krylov.h"

#ifndef hypre_KRYLOV_HEADER
#define hypre_KRYLOV_HEADER

#include <stdlib.h>
#include <stdio.h>
#include <math.h>

#include "_hypre_utilities.h"

#define hypre_CTAllocF(type, count, funcs) \
( (type *)(*(funcs->CAlloc))\
((size_t)(count), (size_t)sizeof(type)) )

#define hypre_TFreeF( ptr, funcs ) \
( (*(funcs->Free))((char *)ptr), ptr = NULL )

#ifdef __cplusplus
extern "C" {
#endif

@

#===========================================================================
# Structures and prototypes
#===========================================================================

cat bicgstab.h   >> $INTERNAL_HEADER
cat cgnr.h       >> $INTERNAL_HEADER
cat gmres.h      >> $INTERNAL_HEADER
cat lgmres.h      >> $INTERNAL_HEADER
cat flexgmres.h      >> $INTERNAL_HEADER
cat pcg.h        >> $INTERNAL_HEADER

../utilities/protos bicgstab.c            >> $INTERNAL_HEADER
../utilities/protos cgnr.c                >> $INTERNAL_HEADER
../utilities/protos gmres.c               >> $INTERNAL_HEADER
../utilities/protos flexgmres.c           >> $INTERNAL_HEADER
../utilities/protos lgmres.c               >> $INTERNAL_HEADER
../utilities/protos HYPRE_bicgstab.c      >> $INTERNAL_HEADER
../utilities/protos HYPRE_cgnr.c          >> $INTERNAL_HEADER
../utilities/protos HYPRE_gmres.c         >> $INTERNAL_HEADER
../utilities/protos HYPRE_flexgmres.c         >> $INTERNAL_HEADER
../utilities/protos HYPRE_lgmres.c         >> $INTERNAL_HEADER
../utilities/protos HYPRE_pcg.c           >> $INTERNAL_HEADER
../utilities/protos pcg.c                 >> $INTERNAL_HEADER

#===========================================================================
# Include guards
#===========================================================================

cat >> $INTERNAL_HEADER <<@

#ifdef __cplusplus
}
#endif

#endif

@

